package com.nbsaas.boot.customer.rest.resource;

import com.nbsaas.boot.customer.api.apis.CustomerInvoiceApi;
import com.nbsaas.boot.customer.data.entity.CustomerInvoice;
import com.nbsaas.boot.customer.api.domain.request.CustomerInvoiceRequest;
import com.nbsaas.boot.customer.api.domain.response.CustomerInvoiceResponse;
import com.nbsaas.boot.customer.api.domain.simple.CustomerInvoiceSimple;
import com.nbsaas.boot.customer.rest.convert.CustomerInvoiceSimpleConvert;
import com.nbsaas.boot.customer.rest.convert.CustomerInvoiceEntityConvert;
import com.nbsaas.boot.customer.rest.convert.CustomerInvoiceResponseConvert;
import com.nbsaas.boot.customer.data.repository.CustomerInvoiceRepository;

import java.io.Serializable;
import com.nbsaas.boot.jpa.data.core.BaseResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;

import java.util.function.Function;
/**
*   -业务接口实现
*/
@Transactional
@Service
public class CustomerInvoiceResource extends BaseResource<CustomerInvoice,CustomerInvoiceResponse, CustomerInvoiceSimple, CustomerInvoiceRequest>  implements CustomerInvoiceApi {

    @Resource
    private CustomerInvoiceRepository customerInvoiceRepository;

    @Override
    public JpaRepositoryImplementation<CustomerInvoice, Serializable> getJpaRepository() {
        return customerInvoiceRepository;
    }

    @Override
    public Function<CustomerInvoice, CustomerInvoiceSimple> getConvertSimple() {
        return new CustomerInvoiceSimpleConvert();
    }

    @Override
    public Function<CustomerInvoiceRequest, CustomerInvoice> getConvertForm() {
        return new CustomerInvoiceEntityConvert();
    }

    @Override
    public Function<CustomerInvoice, CustomerInvoiceResponse> getConvertResponse() {
        return new CustomerInvoiceResponseConvert();
    }




}


